1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| #define MAXN 10000010 #include <cstdio> #include <iostream> using namespace std;
int card1[MAXN],card2[MAXN]; int main(void){ int N,M,buf; const int offset = 10000000; cin>>N; for(int i=0;i<N;i++){ scanf("%d",&buf); if(buf>=0) card1[buf]++; else card2[buf+offset]++; } cin>>M; for(int i=0;i<M;i++){ scanf("%d",&buf); if(buf>=0) printf("%d ",card1[buf]); else printf("%d ",card2[buf+offset]); } return 0; }
|